# define _CRT_SECURE_NO_DEPRECATE 1
#endif
+/* va_copy workaround */
+
+#ifndef va_copy
+# ifdef __va_copy
+# define va_copy __va_copy
+# else
+# error Function 'va_copy' or '__va_copy' is not defined in your environment!
+# error Please mail some information about your system
+# error (platform,compiler,...) to gpsbabel-code@lists.sourceforge.net
+# endif
+#endif
+
/* Pathname separator character */
#if __WIN32__
# define GB_PATHSEP '\\'
char *newbuf;
size_t nextsize = 0;
int outsize;
+ va_list tmp;
bufsize = 0;
for (;;) {
*strp = NULL;
return -1;
}
- bufsize = 1;
+ bufsize = FIRSTSIZE;
} else if ((newbuf = xrealloc(buf, nextsize)) != NULL) {
buf = newbuf;
bufsize = nextsize;
return -1;
}
- outsize = vsnprintf(buf, bufsize, fmt, args);
-
+ va_copy(tmp, args);
+ outsize = vsnprintf(buf, bufsize, fmt, tmp);
+ va_end(tmp);
+
if (outsize == -1) {
/* Clear indication that output was truncated, but no
* clear indication of how big buffer needs to be, so